Skip to content

Conversation

the-thing
Copy link
Contributor

Introduce jcstress module for concurrency stress testing.

Changes

  • new quickfixj-stress-test for manual concurrency stress testing
  • some minor refactoring to quickfix.JdbcStore to allow testing
  • minor formatting fixes

Notes

  • the tests are built as part of package stage, but are never run automatically
  • this PR doesn't fix anything except formatting and renamed Maven property value

I wrote two tests intially. One for quickfix.JdbcStore and one for quickfix.MemoryStore as a starter.

Each test encapsulates only a MemoryStore implementation, but both tests assume that sequence increment is guarded by their respective reentrant lock (which I'm not entirely sure about that this happens everywhere in the code).

Stress test clearly shows that there are concurrency issues in quickfix.JdbcStore implementation - #357. See commens in JdbcStoreStressTest.java. This errors are rare - < 0.01% under specific circumstances.

I think there might be more issues related to reading sequences by different threads e.g. "QFJ Message Processor" thread reading stale sender sequences modified by application threads, but it is hard to confirm.

I hope that I got the mocks right for quickfix.JdbcStore test. Let me know if you see any value in this.

@the-thing the-thing changed the title Jdbc test New jcstress concurrency stress testing module Oct 2, 2025
@chrjohn
Copy link
Member

chrjohn commented Oct 7, 2025

Hi @the-thing , thanks for this, looks very useful. I also recalled that issue #357 when reading your description.
Does it make sense to have some kind of scheduled github action for the stress test?

@the-thing
Copy link
Contributor Author

I'm not sure about the CI integration.

The issues I can see are

  • these stress tests take a long time to run
  • there is no standard way to capture the results (at least I'm not aware of), but the reports in are generated in the console and html files
  • the action would have to wait for main pipeline to finish and download jcstress module files and run them (I think this is relatively easy to do)

I don't think I have seen jcstress running as part of CI pipeline before. Normally when one suspects a concurrency bug. You write jcstress test, fix it and rerun. Having it as part of the project makes things easier with manual re-runs and setup.

However, I have seen benchmarks being run automatically for continuous performance monitoring.

It depends how you are planning on using it. I imagine there is another job that runs after the main CI build that always succeeds and if anyone is interested can view the results on demand. Is that what you are after?

@chrjohn
Copy link
Member

chrjohn commented Oct 20, 2025

The main interest for me (besides finding existing bugs) was that no further bugs are introduced. Just wanted to automate it because otherwise I'll probably forget to run it on a regular basis. =)

@the-thing
Copy link
Contributor Author

This is doable, but it might require additional effort. You would also have to expect that the current action's build times to increase significantly.

You will have to write tests first. I would expect that whoever opens a new PR with concurrency fix will back it up with jcstress test and mention to run it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants